//
//  TItleScrollView.m
//  Meng
//
//  Created by dllo on 15/9/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "TItleScrollView.h"

@implementation TItleScrollView
- (void)dealloc
{
    [_scrollView release];
    [_button release];
    [super dealloc];
}
- (instancetype)initWithFrame:(CGRect)frame arr:(NSMutableArray *)array
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        self.scrollView  = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
        [self addSubview:self.scrollView];
        [_scrollView release];
        NSMutableArray *arr = [NSMutableArray array];
        for (HomeModel *model in array) {
            [arr addObject:model.name];
        }
        for (int i = 0 ; i < 6; i++) {
            self.button = [UIButton buttonWithType:UIButtonTypeSystem];
            self.button.frame = CGRectMake(self.frame.size.width / 6 * i, 0, self.frame.size.width / 6, self.frame.size.height);
            [self.button setTitle:arr[i] forState:UIControlStateNormal];
            [self addSubview:self.button];
            self.button.tag = i + 10;
            self.button.tintColor = [UIColor grayColor];
            if (i == 0) {
                self.button.titleLabel.font = [UIFont systemFontOfSize:20];
            }
        }
        
    }
    return self;
}

@end
